package com.itheima.TSS;

import org.jetbrains.annotations.NotNull;

/**
 * @author zhangbaiyan
 * @date 2024-09-11 22:37
 * @description:
 * @version:
 */
public class TreeSetStudent  implements Comparable<TreeSetStudent>{
    private String name;
    private int age;

    public TreeSetStudent() {
    }

    public TreeSetStudent(String name, int age) {
        this.name = name;
        this.age = age;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "TreeSetStudent{" +
                "name='" + name + '\'' +
                ", age=" + age +"总分:"+(this.getAge()+this.getAge()+this.getAge())+
                '}';
    }

    @Override
    public int compareTo(@NotNull TreeSetStudent o) {
        return this.getAge() - o.getAge();
    }
}
